﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using BlobTowerDefense.Tools;

namespace BlobTowerDefense.Pages.Controls
{
    public partial class ControlsSettings_Controls : UserControl
    {
        public ControlsSettings_Controls()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(ControlsSettings_Controls_Loaded);
        }

        void ControlsSettings_Controls_Loaded(object sender, RoutedEventArgs e)
        {
            ToggleButton_Lefthanded.IsChecked = Loader.Load_LeftHanded();
            Slider_Sensitivity.Value = Loader.Load_Sensitivity();
            TextBox_Nickname.Text = Loader.Load_NickName();
        }

        private void ToggleButton_Lefthanded_Checked(object sender, RoutedEventArgs e)
        {
            Saver.Save_LeftHanded(true);
        }

        private void ToggleButton_Lefthanded_Unchecked(object sender, RoutedEventArgs e)
        {
            Saver.Save_LeftHanded(false);
        }

        private void Slider_Sensitivity_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            Saver.Save_Sensitivity(e.NewValue);
        }

        private void TextBox_Nickname_TextChanged(object sender, TextChangedEventArgs e)
        {
            Saver.Save_NickName(TextBox_Nickname.Text);
        }
    }
}
